<template>
	<div class="main">
		<div class="title">评教首页</div>
		<div class="list"><span>评教列表</span></div>
		<van-collapse v-model="activeNames" v-for="(item,index) in teacherInfo" @change="selectPersonScoreByActivityId(item.evalution_activity_id)">
		 <!-- <div @click="getActivityLists(item)"> -->
			 <van-collapse-item  :title="item.title" :name="index">
		   <div class="evaluationList" v-for="item1,index1 in courseInfo" @click="toDetailScore(item.evalution_activity_id,item1.teacher_id)">
			
			<div class="no">{{item1.courseclass_no}}</div>
		   	<div class="name">{{item1.courseName}}</div>
		   	<!-- <div class="term" >{{}}</div> -->
		   	<div class="score">{{item1.evaluation_score}}</div>
		   </div>
		  </van-collapse-item>
		 <!-- </div> -->
		</van-collapse>
		<div class="low">
			<router-view></router-view>
			<van-tabbar v-model="active" route>
			  <van-tabbar-item replace to="/teacher" icon="home-o">首页</van-tabbar-item>
			 <!-- <van-tabbar-item replace to="/server" icon="search">服务中心</van-tabbar-item> -->
			  <!-- <van-tabbar-item icon="friends-o">标签</van-tabbar-item> -->
			  <van-tabbar-item replace to="/teacherInfo" icon="setting-o">个人信息</van-tabbar-item>
			</van-tabbar>
		</div>
	</div>
</template>

<script>
	import {getActivityList,calculateEvaluationScoresOfTeacher,selectPersonScoreByActivityId} from '@/api/teacher'
	export default {
		data() {
			return{
				activeNames:[],
				active:0,
				teacherInfo:[],
				courseInfo:[]
			}
		},
		created() {
			// this.calculateScore()
			this.getActivityList()
		},
		methods:{
			// async calculateScore(){
			// 	const result= await calculateEvaluationScoresOfTeacher();
			// 	if(result.code==200){
			// 		this.getActivityList()
			// 	}
			// },
		    async getActivityList(){
				const term="0"
				const result=await getActivityList(term);
				if(result.code==200){
					console.log(result)
					this.teacherInfo=result.data
				}
			},
			async selectPersonScoreByActivityId(id){
				const result=await selectPersonScoreByActivityId(id)
				if(result.code==200){
					console.log(result)
					this.courseInfo=result.data
				}
			},
			toDetailScore(id,teacherId){
				this.$router.push({path:'/detailScore',query:{evaluationId:id,teacherId:teacherId}})
			}
		}
	}
</script>

<style scoped>
	.title{
		text-align: center;
		padding-top: 10px;
		font-size: 24px;
	}
	.list{
		padding: 5px 0 0 5px;
		font-size: 24px;
		border: #39a9ed solid 1px;
		/* border-radius: 8%; */
		background-color: #39a9ed;
	}
	.evaluationList{
		/* padding-top: 6px; */
		font-size: 20px;
		display: flex;
	}
	.evaluationList .name{
		padding-left: 80px;
		color: #000;
	}
	.evaluationList .no{
		padding-left: 6px;
		color: #000;
	}
	.evaluationList .score{
		padding-left: 90px;
		color: #000;
	}
</style>